package com.snow.useviewdemo.viewpager2;

import android.content.Intent;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.flyco.tablayout.SlidingTabLayout;
import com.snow.common.base.BaseBasesActivity;
import com.snow.useviewdemo.R;

import java.time.Instant;
import java.util.ArrayList;

import butterknife.BindView;

/**
 * author : zyt
 * e-mail : 632105276@qq.com
 * date   : 2019-10-11
 * desc   :
 */
public class NewsActivty extends BaseBasesActivity {
    @BindView(R.id.sliding_tablayout)
    SlidingTabLayout slidingTablayout;
    @BindView(R.id.view_pager)
    ViewPager viewPager;
    String[] titles = {"军事", "娱乐", "百科", "科技"};

    @Override
    protected int getContentViewId() {
        return R.layout.activity_news;
    }

    @Override
    protected void initView() {
        ArrayList<Fragment> list = new ArrayList<>();

        list.add(NewsFragment.getInstance("你哈"));
        list.add(NewsFragment.getInstance("记号笔"));
        list.add(NewsFragment.getInstance("受到广泛"));
        list.add(NewsFragment.getInstance("地方"));
        slidingTablayout.setViewPager(viewPager, titles, this, list);

        findViewById(R.id.btn_viewpager2).setOnClickListener(view -> {
            startActivity(new Intent(NewsActivty.this, NewsViewPager2Activity.class));
        });
    }

}
